Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add long URLs to Most Visited table on homepage #127

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

shaftoes
Copy link

@shaftoes shaftoes commented May 10, 2024

We've been using golinks internally for a few months now and are really loving it!

As it stands, the Most Visited table is a great place for people to find useful shortlinks, but if the name isn't descriptive then your only recourse is to click the link. This makes it harder for new users to start getting value out of the service.

Screen Shot 2024-05-10 at 10 14 18 AM

@shaftoes shaftoes force-pushed the add-full-url-to-homepage branch from ba76ed2 to 877c565 Compare May 10, 2024 14:23
@wlach
Copy link

wlach commented Mar 7, 2025

@willnorris any chance for a review on this?

@@ -404,10 +405,21 @@ func serveHandler() http.Handler {
func serveHome(w http.ResponseWriter, r *http.Request, short string) {
var clicks []visitData

linkMap := map[string]string{}
links, err := db.LoadAll()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

db.LoadAll() here sort of defeats the use of the in memory stats struct to keep the initial page home page load performant if the db has many links in it.

Instead of loading everything and mapping it against the in memory variable, could the stats struct instead be updated to include the long URL also for display?

It would keep the main page snappy and avoids hitting the db/disk if there's many links to load.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry about the delay. my review was mainly going to focus on this. Loading every link on every page load isn't great. The issue with storing the long URL in the stats struct is just needing to make sure to keep it up to date with changes to the link value.

As for rendering, we should use the same style as the http://go/.all page (long URL underneath the short URL) rather than another column to the right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants